<template>
    <div>
        <van-nav-bar
          title="系统通知"
          left-arrow
          @click-left="onClickLeft"
        />
        <h2>发布通知</h2>
        <van-cell-group inset>
          <van-field
            v-model="message"
            rows="5"
            autosize
            type="textarea"
            maxlength="50"
            placeholder="请输入留言"
            show-word-limit
          />
      </van-cell-group>
      <van-button class="btn" type="primary" @click="btn()">发布</van-button>
    </div>
</template>

<script>
import { ref } from 'vue';
import axios from 'axios'
import router from '@/router';
export default {
    setup() {
        const loading = ref(true);
        const currentTime = ref('12:00');
        const onClickLeft = () => history.back();
        const value = ref('');
        return {
            onClickLeft,
            loading,
            value,
            currentTime
        };
  },
  methods: {
    btn() {
      axios.put("http://localhost:8087/announcement/updateAnnouncement", {
        announcementId: 0,
        announcementContent: this.message,
      }).then(function(res){
        router.push('/ppc')
      })
    }
  }
}
</script>

<style lang="scss" scoped>
 h2{
    font-size: 6vw;
    text-align: left;
    margin-left: 5%;
    margin-top: 5%;
    margin-bottom: 3vw;
 }
 .sj{
  display: none;
 }
 .van-field{
  border: 1px solid #000;
 }
 .btn{
  width: 85vw;
  font-size: 4vw;
  font-weight: bold;
  margin-top: 10vw;
 }
</style>